package com.shanlin.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/*
 * 全局异常捕获
 */
@ControllerAdvice
public class GlobalExceptionHadler {
	@ExceptionHandler(RuntimeException.class)
	@ResponseBody
	public Map<String, Object> errorHandler() {
		Map<String, Object> result = new HashMap();
		result.put("code", "500");
		result.put("message", "系统异常");
		return result;
	}
}
